package net.kodra.supereasy.traffic.server;

import java.util.logging.Logger;

import net.kodra.supereasy.traffic.shared.Station;

import com.google.appengine.api.labs.taskqueue.Queue;
import com.google.appengine.api.labs.taskqueue.QueueFactory;
import com.google.appengine.api.labs.taskqueue.TaskOptions;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;



public class TrafficManager
{

  private static final Logger LOGGER = Logger.getLogger(TrafficManager.class.getName());

  static
  {
    ObjectifyService.register(Station.class);
  }

  private static Objectify ofy = ObjectifyService.begin();

  public static void queueStationRequest(Station station)
  {
    Queue defaultQueue = QueueFactory.getDefaultQueue();
    defaultQueue.add(TaskOptions.Builder.url("/mvg-sync/worker").param("stationName", station.getName()));

  }

  public static void queueStationRequest(String stationName)
  {
    Queue defaultQueue = QueueFactory.getDefaultQueue();
    defaultQueue.add(TaskOptions.Builder.url("/mvg-sync/worker").param("stationName", stationName));

  }


}